//
//  ZCViewController.m
//  UI豆瓣2015到2016跨年作业
//
//  Created by LHY on 15/12/31.
//  Copyright © 2015年 Lanou 32 李昊宇. All rights reserved.
//

#import "ZCViewController.h"
#import "TL1View.h"
#import "UpViewController.h"
#import "TL1View.h"


@interface ZCViewController ()<UITextFieldDelegate>

@end

@implementation ZCViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.

    self.navigationController.navigationBar.translucent = NO;
    self.navigationItem.title = @"注册";
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    TL1View *tl = [[TL1View alloc] initWithFrame:CGRectMake(20, 20, 300, 50)];
     tl.Lable.text = @"用户名:";
    tl.tf.placeholder = @"请输入用户名";
    [self.view addSubview:tl];
    tl.tf.delegate = self;
    TL1View *tt = [[TL1View alloc] initWithFrame:CGRectMake(20, 80, 300, 50)];
    tt.Lable.text = @"密码:";
    tt.tf.placeholder = @"请输入密码";
    tt.tf.secureTextEntry = YES;
    [self.view addSubview:tt];
    tt.tf.delegate = self;
    TL1View *tq = [[TL1View alloc] initWithFrame:CGRectMake(20, 140, 300, 50)];
    tq.tf.delegate = self;
    tq.Lable.text = @"确认密码";
    tq.tf.placeholder = @"再次输入密码";
    [self.view addSubview:tq];
    TL1View *ttt = [[TL1View alloc] initWithFrame:CGRectMake(20, 200, 300, 50)];
    ttt.tf.delegate = self;
    ttt.Lable.text = @"邮箱";
    ttt.tf.placeholder = @"请输入邮箱";
    [self.view addSubview:ttt];
    TL1View *tttt = [[TL1View alloc] initWithFrame:CGRectMake(20, 400, 300, 50)];
    tttt.Lable.text = @"联系方式";
    tttt.tf.delegate = self;
    tttt.tf.placeholder = @"请输入联系方式";
    tttt.tf.keyboardType = UIKeyboardTypeDefault;
    tttt.tf.returnKeyType = UIReturnKeyGoogle;
    [self.view addSubview:tttt];
    
    



}


- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    [textField resignFirstResponder];
    return YES;


}

- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
   
        CGFloat height = textField.superview.frame.origin.y
        - self.view.frame.size.height / 2;
        if (textField.superview.frame.origin.y > self.view.frame.size.height / 2) {
            self.view.center = CGPointMake(self.view.center.x, self.view.center.y - height);
        }

    NSLog(@"%f", self.view.center.y);
    return YES;
}


- (BOOL)textFieldShouldEndEditing:(UITextField *)textField {

    self.view.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
    
    
    return YES;

}




- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
